#!/bin/bash

file=$(cd "$(dirname "$0")";pwd)
#noreboot_load需要转义,不能用命令获取路径，每次使用注意脚本路径是否正确
noreboot_load="^#ExecStartPre=\/home\/sietium\/env\/reboot1.sh"
reboot_load="ExecStartPre=${file}/reboot1.sh"
URL=/lib/systemd/system/lightdm.service
sed -i "/${noreboot_load}/d" "$URL"
echo ${reboot_load} >> "$URL" 
echo 1 > ${file}/reboot_num.txt
shutdown -r now  
